home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / make3.lqr / MAKE3.DOC next >
Text File  |  1985-06-05  |  8KB  |  192 lines

  1. /*
  2.   This a  called 'Make'    and is a much simplified version of
  3.   the make utility on UNIX (a trademark    or something of    AT&T)
  4.   written  using the Lattice C compiler
  5.   for the  IBM Personal    Computer.  The Lattice package is
  6.   available from Lifeboat Assoc. 1651 Third Avenue
  7.   New York, NY 10128 .
  8.  
  9.   'Make'  takes    a  file    of  dependencies (a  'makefile') and
  10.   decides  what    commands have to be executed to    bring the  files
  11.   up to    date.  These commands are  either  executed  directly from
  12.   'Make'  or written to    the standard output without executing
  13.   them.
  14.  
  15. 'Makefile' format:
  16.   - There  must    be  a 'makefile'; you can't  take input    from  the
  17.   standard input.
  18.   - The    default    name of    the 'makefile' is  'MAKEFILE'  on the
  19.   default  disk.  Different 'makefiles'    can be specified using
  20.   the '-f' option  on the  command  line.  If the '-f' option is
  21.   used,    the default 'makefile' is  not processed.
  22.   - Any    blank lines in the 'makefile(s)'  are ignored.
  23.   - A line in a    'makefile' that    starts with a tab  character is
  24.   a 'howto' line  and consists of  a command name followed  by
  25.   arguments.  The  command  name must be a file    name,  e.g.
  26.   'cc'.     When  commands    are executed,  the PATH     environment
  27.   variable is used to find the command,    in (hopefully) the
  28.   same manner as  DOS does. 'Howto'  lines apply to the    most
  29.   recently preceding 'dependency'  line.  It is    an  error for
  30.   a 'howto' line  to precede the first 'dependency' line.
  31.   - Any    other non-blank    line is    a  'dependency'    line.  'Dependency'
  32.   lines    consist    of a filename followed by  a (possibly empty) list
  33.   of dependent filenames.
  34.  
  35. Operation:
  36.   Syntax:
  37.     make [filename]  [-f makefilename] [-i] [-n]
  38.   -i means continue even  if an    error is encountered while
  39.     executing a    command.
  40.   -n means don't  execute  the commands, just write  the ones that
  41.     should be executed to  the standard    output.     This is useful
  42.     for    creating batch files, for  example.
  43.   -f specifies that the    following  argument is the  name of  a makefile
  44.     to be  used    instead    of  the    default    (MAKEFILE).
  45.   All arguments    may be repeated    and relative position of  the
  46.   arguments is not important.  If  multiple definitions    of  a file
  47.   are found, only  the first one is significant.
  48.  
  49.   First,  'Make' reads all  of the  makefiles.    It then    proceeds through
  50.   all of  the filename arguments,  'making'  each one in turn.    A file
  51.   is remade if it  is out  of date  with respect to  the files it depends
  52.   on or    is non-existent.  Dependencies are processed in    a  'tree' fashion,
  53.   so that  the lowest-order files  are remade first.
  54.  
  55.   'Make'  cannot execute DOS built-in commands e.g. 'cd' or 'dir'.
  56.   'Make'  uses the  first 20k or so  after the resident    portion    of DOS.
  57.   all definitions and howto's are stored in dynamically    allocated struct's.
  58.  Any executed commands are loaded above    'Make'    in memory.
  59.  
  60.   'Make'  REQUIRES  DOS    2.0  (or higher?).
  61.  
  62.  
  63.   The code is a    little kludgy in  places.
  64.  
  65.   No guarantees    or warranties of  any kind:  I think it    works and
  66.   I use    it.
  67.  
  68.   Any suggestions  for improvements gratefully accepted.
  69.  
  70.   I believe that  commercial versions exist.  I    also beleive that  they
  71.   would    be superior to this.
  72.  
  73. version    2.0 comments:
  74.   This program was converted to    Lattice    'C' ver    2.11 on    15 jun 84.
  75.   This allowed the use of the lattice 'fork' command. The command
  76.   will automatically search the    path name specified to find the
  77.   desired executable image. This also allows the use of    image names
  78.   with out the extension. ie 'lc1' instead of 'lc1.exe'. All of
  79.   the assembler    routines have been replaced with lattice dos calls.
  80.  
  81.   The Lattice version uses about 55k bytes less    memory than the
  82.   Desmet version. This is nice for the systems with already tight
  83.   memory requirements.
  84. version    3 comments:
  85.   The default makefile name is MAKEFILE    not MAKEFILE.DAT.
  86.   There    now is a symbol    processor to do    substitiutions
  87.     in the argument line.
  88.   A symbol definition MUST begin with a    $.
  89.   An example follows.
  90.   Fixed    a bug-If a dependent file did not exist    then make didn't
  91.     work correctly.
  92.   Checks to see    if a command results in    a non-zero return code.
  93.     If so then aborts unless the -i flag is used.
  94.  
  95.   Any comments on this code should be directed to
  96.   Jeffrey Spidle
  97.   Systems Analyst
  98.   Office of Continuing Education
  99.   Iowa State University
  100.   Ames,    IA 50011
  101.   or a message on one of the following BBS.
  102.   Gene Plantz (312)887-4227
  103.   Lynn Long (918)749-0718
  104.   Bob Blackwell    (319)363-3314
  105.  
  106.  
  107. */
  108.  
  109.  
  110. /*
  111. Written     by John  M Sellens, April, 1984
  112. Modified for Lattice C ver 2.11    by Jeff    Spidle jun 15 84
  113.  
  114. Code is     all original except where indicated otherwise.
  115.  
  116. Until August, 1984:
  117.   jmsellens@watrose.UUCP
  118.  
  119.   107 -    180 Brybeck Cres.
  120.   Kitchener, Ontario
  121.   N2M 5G4
  122.  
  123. After August, 1984:
  124.   c/o 1135 Lansdowne Ave.  SW
  125.   Calgary, Alberta
  126.   T2S 1A4
  127.  
  128. (c) Copyright 1984 John     M Sellens
  129. Permission is granted to use, distribute and/or     modify    this code unless
  130. done for direct     commercial profit.  If    you find  these    routines useful,
  131. modest contributions (monetary or otherwise) will be gratefully     accepted.
  132. Author's name, address and this     notice    must be    included  in any copies.
  133.  
  134. <TAB> =    ASCII 09
  135. An example: To compile this program the    following makefile was used
  136. $CFLAGS    -ms -i/code/c/lc/
  137. make.exe make.obj
  138. <TAB>link /code/c/lc/s/cs+make,make,make,/code/c/lc/s/lcs -map
  139. make.obj make.c    /code/c/lc/stdio.h
  140. <TAB>lc1 make $CFLAGS -i/code/c/lc/s/ -n
  141. <TAB>lc2 make
  142.  
  143.    An explination: make.exe is a dependent file. Is is dependent on
  144.    make.obj. make.obj is dependent on make.c and stdio.h. If the
  145.    following command is    issued:MAKE make.exe then make will
  146.    check to see    if either make.c or stdio.h has    a newer    date&time
  147.    than    make.obj. if so    then the 2 compile instructions    are issued.
  148.    then    the link instruction will be issued. If    only make.obj is
  149.    newer than make.exe then only the link step would be    executed.
  150.  
  151. The symbol substitution    will end up having the lc1 call    look like
  152.   lc1 make -ms -i/code/c/lc/ -i/code/c/lc/s/ -n
  153.  
  154. Hints: Dependencies can    be in any order. Make will resolve them
  155.        correctly.
  156.  
  157.        How to lines must begin with a <TAB> not    just 7 spaces.
  158.  
  159.        Symbol definition lines must start with a $.
  160.  
  161.        Symbols cannot have other symbols in their definition.
  162.  
  163.        A symbol    may have a max of 39 characters.
  164.  
  165.        The equate for a    symbol may be up to 80 characters.
  166.  
  167.        You may have an unlimited(within    reason)    number of
  168.        symbols.
  169.  
  170.        A symbol    that is    not defined will be copied to the
  171.        output line. ie
  172.        lc2 $TEST
  173.        with $TEST not defined will create the command
  174.        lc2 $TEST
  175.  
  176.        Symbols are case    specific. upper    and lower case are significant.
  177.  
  178.        The command line    must specify what file you wish    to
  179.        make. You may have more than one    set of file definitions
  180.        in a makefile. If you do     you may run out of memory. I
  181.        haven't run into    this yet but I suppose it is possible.
  182.  
  183.        If a command returns an error-code (ERRORLEVEL) not equal
  184.        to zero then MAKE thinks    that there was an error. MAKE
  185.        will abort processing unless the    -i (ignore errors) flag
  186.        is used.
  187.  
  188. Any suggestions    or improvements    will be    much appreciated. I
  189. am next    going to try to    put definable symbols for substitution
  190. in a makefile next aka UNIX-MAKE. So we    will see what happens.
  191. */
  192. xt    going to tr